//
//  LCHorizontalGrideView.h
//  JKHorizontalGrideView
//
//  Created by jiukuyinyue on 2017/8/18.
//  Copyright © 2017年 LC. All rights reserved.
//

#import <UIKit/UIKit.h>

/*
 依赖库
 1. Masonry
 2. SDWebImage
 */

@class LCHorizontalGrideView;

@protocol LCHorizontalGrideViewDataSource <NSObject>

@optional
/**
 提供数据的数量
 
 @param horizontalGrideView 控件本身
 @return 返回数量
 */
- (NSInteger)numberOfItemsInHorizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView;


/**
 提供选项标题
 
 @param horizontalGrideView 当前控件
 @param index 选项下标
 @return 返回标题
 */
- (NSString *)horizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView titleForItemAtIndex:(NSInteger)index;


/**
 提供选项的图标地址路径
 
 @param horizontalGrideView 当前控件
 @param index 选项下标
 @return 返回图标
 */
- (NSString *)horizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView iconURLForItemAtIndex:(NSInteger)index;

@end

@protocol LCHorizontalGrideViewDelegate <NSObject>

@optional
/**
 设置每页的行数 默认 2
 
 @param horizontalGrideView 当前控件
 @return 行数
 */
- (NSInteger)numberOfRowsPerPageInHorizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView;


/**
 设置每页的列数 默认 4
 
 @param horizontalGrideView 当前控件
 @return 列数
 */
- (NSInteger)numberOfColumnsPerPageInHorizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView;

/**
 当选项被点击回调
 
 @param horizontalGrideView 当前控件
 @param index 点击下标
 */
- (void)horizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView didSelectItemAtIndex:(NSInteger)index;

/**
 返回当前选中的pageControl 颜色
 
 @param horizontalGrideView 当前控件
 @return 颜色
 */
- (UIColor *)colorForCurrentPageControlInHorizontalGrideView:(LCHorizontalGrideView *)horizontalGrideView;
@end


/**
 横向网格控件
 */
@interface LCHorizontalGrideView : UIView

@property (weak, nonatomic) id<LCHorizontalGrideViewDataSource> dataSource;

@property (weak, nonatomic) id<LCHorizontalGrideViewDelegate>   delegate;

@property (strong, nonatomic)   UIImage                         *defaultImage;

@property (assign, nonatomic)   NSInteger       celltype;//1 奉献支持的样式

/**
 刷新
 */
- (void)reloadData;
@end
